<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <script src="https://cdn.bootcss.com/vue/2.6.11/vue.min.js"></script>
</head>
<body>
    <div id="app">
        <a @click.prevent="flag=true">去登录</a>
        <a @click.prevent="flag=false">去注册</a>
        <login-component v-if="flag"></login-component>
        <register-component v-else="flag"></register-component>
    </div>    

    <template id="t1">
        <div>
            <h3>登录UI</h3>
        </div>
    </template>

    <template id="t2">
        <div>
            <h3>注册UI</h3>
        </div>
    </template>

    <script>
        // 组件之间的切换。
        var app = new Vue({
            el: "#app",
            data: {
                flag: true
            },
            components: {
                "loginComponent": {
                    template: "#t1"
                },
                "registerComponent": {
                    template: "#t2"
                }
            }
        });
    </script>
</body>
</html>